package com.jdz.controller.backend;


import com.jdz.common.ServerResponse;
import com.jdz.service.IRaceTypeDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/manage/racetypedetails")
public class RaceTypeDetailsManageController {


    @Autowired
    IRaceTypeDetailsService iRaceTypeDetailsService;


    /**
     * 列出项目类型详情和当前类型处以比赛的等级
     * @param racetypeno
     * @return
     */
    @RequestMapping(value = "details.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse details(Integer racetypeno){
        return iRaceTypeDetailsService.details(racetypeno);
    }

    /**
     * 添加项目类型详情
     * @param racetypeno
     * @param racetypedetailed
     * @return
     */
    @RequestMapping(value = "add.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse add(Integer racetypeno,String racetypedetailed){
        return iRaceTypeDetailsService.add(racetypeno,racetypedetailed);
    }


    /**
     * 修改项目类型详情
     * @param racetypeno
     * @param racetypedetailed
     * @return
     */
    @RequestMapping(value = "update.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse update(Integer racetypeno,String racetypedetailed){
        return iRaceTypeDetailsService.update(racetypeno,racetypedetailed);
    }


    /**
     * 开启下一轮比赛  0为未开始比赛，-1表示结束，其他表示轮次
     * @param racetypeno
     * @return
     */
    @RequestMapping(value = "next_level.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse nextLevel(Integer racetypeno){
        return iRaceTypeDetailsService.nextLevel(racetypeno);
    }



    /**
     * 设置比赛轮次
     * @param racetypeno
     * @return
     */
    @RequestMapping(value = "set_level.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse setLevel(Integer racetypesamsarano,Integer racetypeno){
        return iRaceTypeDetailsService.setLevel(racetypesamsarano,racetypeno);
    }


    /**
     * 结束比赛
     * @param racetypeno
     * @return
     */
    @RequestMapping(value = "stop_level.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse stopLevel(Integer racetypeno){
        return iRaceTypeDetailsService.stopLevel(racetypeno);
    }
}
